package com.itheima.demo02interface;

import org.junit.Test;

import java.util.Date;
import java.util.function.Function;
import java.util.function.Supplier;

public class Demo09MethodRef {
    public static void main(String[] args) {

    }

    @Test
    public void test(){
        Date now = new Date();
        Supplier<Long> supplier = now::getTime;

        System.out.println(supplier.get());
    }

    @Test
    public void test2(){
        Supplier<Long> supplier = System::currentTimeMillis;

        System.out.println(supplier.get());
    }

    @Test
    public void test3(){
        Function<String, Integer> function = String::length;

        int length = function.apply("hello");
        System.out.println("length = " + length);
    }
}
